package com.iglooit.components.gui
{
	import mx.containers.Form;
	import mx.containers.FormItem;

	public class XMLForm extends Form implements IXMLContainer
	{
		public function XMLForm()
		{
			super();
		}

		public function get xmllist():XML
		{
			var xmllist:XML=<form />;
			for each (var item:Object in this.getChildren())
			{
				if (item is FormItem)
				{
					for each (var obj:Object in item.getChildren())
					{
						if (obj is IXMLComponent && obj != null)
						{
							(obj as IXMLComponent).submit();
							var tt:XML = (obj as IXMLComponent).xml;
							xmllist.appendChild(tt);
						}
						else if(obj is IXMLContainer && obj != null)
						{
							for each(var childrenxml:XML in (obj as IXMLContainer).xmllist.children())
							{
								xmllist.appendChild(childrenxml);
							}
						}
					}
				}

			}
			return xmllist;
		}
	}
}